<template>
  <div class="search">
    <f-form ref="form" :action="api.bib" :form-key="this.formItem.bankId" >
      <f-form-item label="开票单位ID"  name="invoiceunitId"    :value="formItem.invoiceunitId" />
      <f-form-item label="银行名称"  name="bankName"    :value="formItem.bankName" />
      <f-form-item label="银行卡号"  name="bankNo"    :value="formItem.bankNo" />
      <f-form-item label="银行状态"  name="bankState" dataType="number"   :value="formItem.bankState" />
      <f-form-item label="联系人"  name="linkMan"    :value="formItem.linkMan" />
      <f-form-item label="联系电话"  name="linkTel"    :value="formItem.linkTel" />
      <f-form-item label="账户类型"  name="bankType" dataType="number"   :value="formItem.bankType" />
      <f-form-item label="备注"  name="remark"    :value="formItem.remark" />
      <f-form-item label="添加时间"  name="createTime"    :value="formItem.createTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'bibForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          bankId: '',
          invoiceunitId: '',
          bankName: '',
          bankNo: '',
          bankState: '',
          linkMan: '',
          linkTel: '',
          bankType: '',
          remark: '',
          createTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.bankId) {
          let params={
              bankId:data.bankId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
